package com.example.easy.Controller;

import com.example.easy.Service.myservice.AdministratorsService;
import com.example.easy.Tools.ResultCode;
import com.example.easy.mapper.AdministratorsMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@Api(value = "Administrators", description = "管理员管理")
@RequestMapping(value = "/dministrators")

public class Administrators {

    @Autowired
    AdministratorsService administratorsService;

    @Autowired
    AdministratorsMapper administratorsMapper;

    @ApiOperation(value = "登入", notes = "登入")
    @RequestMapping(value = "/adminlogin", method = RequestMethod.POST)
    public Object login(@RequestParam String username, @RequestParam String psd) throws IOException {

        System.out.println(username);
        return ResultCode.SUCCESS.result(administratorsService.login(username, psd));

    }

}
